-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include Border everywhere #650
Conversation
If we can create for example a Grid and apply corners, a border, shadow, etc. Does it make sense to keep the Frame in .NET MAUI or does it become a deprecated and available control, but only in the Compatibility package? Feedback? |
Nice, I have been thinking about submitting a proposal about this for the longest time but ... I was lazy I guess 😅. Well, next step shadows (with multiple layer shadows 😮) on IFrameworkElement and I wouldn't mind multiple backgrounds with transparencies and offsets ... a true CSS parity is what I have in mind. But ... one step at a time 🤷♂️. |
@AmrAlSayed0 Well, you can take a look to the Shadows PR too #570 |
@jsuarezruiz please also implement IShadow everywhere like described here: |
If that is the case. I personally think the frame is now deprecated. Let's remove it. |
e997c08
to
354239b
Compare
Awesome!! Thanks @jsuarezruiz for impplementing this. I am wondering if everywhere means also form controls such as Entry, Editors, pickers, etc. Hopefully yes 🙏🏻 |
@jsuarezruiz was there a technical reason that made it very non-trivial to support IShape to specify the border/corners? If that's possible it would be great for customization, and we can still support ICornerRadius by applying a rounded rectangle clip shape. |
src/Controls/src/Core/Button.cs
Outdated
@@ -38,7 +38,7 @@ public partial class Button : View, IFontElement, ITextElement, IBorderElement, | |||
|
|||
public static readonly BindableProperty FontAutoScalingEnabledProperty = FontElement.FontAutoScalingEnabledProperty; | |||
|
|||
public static readonly BindableProperty BorderWidthProperty = BindableProperty.Create("BorderWidth", typeof(double), typeof(Button), -1d); | |||
public static readonly new BindableProperty BorderWidthProperty = BindableProperty.Create("BorderWidth", typeof(double), typeof(Button), -1d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just delete all of these? What's the reason to keep any of these around now that the base class has this same property with the same type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will review this case in all the platforms. In theory, if you set the BorderWidth to 0, are mostly removing the custom border and drawing again the native control specific border. Take a look to the gif included in the first message. Seems to be Android?. Anyway, will review in all the platforms this case. |
# Conflicts: # src/Core/src/Handlers/View/ViewHandler.cs # src/Core/src/Platform/Android/ViewExtensions.cs
/// Gets a collection of Double values that indicate the pattern of dashes and gaps | ||
/// that is used to outline shapes. | ||
/// </summary> | ||
double[] BorderDashArray { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this needs to be reconciled with IShapeView because IShapeView also has APIs that seem to match these ones. This causes ShapeView to have
public float[]? StrokeDashPattern => throw new System.NotImplementedException();
public double[] BorderDashArray => throw new System.NotImplementedException();
@@ -21,4 +20,19 @@ public DoubleCollection(double[] values) | |||
public static implicit operator DoubleCollection(float[] f) | |||
=> f == null ? new() : new(Array.ConvertAll(f, x => (double)x)); | |||
} | |||
|
|||
public static class DoubleCollectionExtensions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is ToArray() not working here?
@@ -14,7 +15,8 @@ sealed class Style | |||
} | |||
|
|||
public IDictionary<string, string> Declarations { get; set; } = new Dictionary<string, string>(); | |||
Dictionary<KeyValuePair<string, string>, object> convertedValues = new Dictionary<KeyValuePair<string, string>, object>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be a tuple (x, y)
so they can be named and also show what this is?
# Conflicts: # src/Controls/samples/Controls.Sample/Pages/Controls/ButtonPage.xaml
The one downside of wrapping or clipping for a border is that the controls break if they have their own system. This is fine for things like layouts, labels or any other elements that do not natively have "chrome". However, some controls already have this and might need customization for each, or maybe should use the native features. This will also be noticeable on windows 11 when we get the rounded corners. If I set the corner radius to less than the default, then you will see it through/behind the overlay border. Things like text boxes are also a bit different. In most cases, you can remove the borders and things. but this is not the same as just adding a border. The underlying control needs adjustments. |
Have sense to allow apply a custom border in any View?. For example, can create a custom border setting the Stroke properties in a Shape. |
I think it makes sense. Because that will bring the ability to design UIs that could render a view kids friendly. Just thinking on that at first glance of course. |
Hello @jsuarezruiz, I hope you are good! 😀. Excuse me, I am wondering if on .NET MAUI the form controls such as entries, editors, pickers, etc will feature padding property. Due to when we change the border corner for example on Entries or editors the inner text and placeholder cannot be set a padding to accomodate the text inside the form control. Just curiosity. Thanks in advance for the amazing team work!!! |
@rmarinho What happened? |
@AmrAlSayed0 we decided to go with #2445 , so we will have a Border control instead of Border in any control. |
Description of Change
Include CornerRadius and Border everywhere.
Related Spec: #10
Changes:
Added to
IFrameworkElement
:Fixes:
Platforms Affected
PR Checklist
Does this PR touch anything that might effect accessibility?
No